| Conditions | 2 |
| Total Lines | 51 |
| Code Lines | 40 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | import React, { Component } from 'react' |
||
| 36 | |||
| 37 | render () { |
||
| 38 | return ( |
||
| 39 | <div> |
||
| 40 | <Dock |
||
| 41 | fluid |
||
| 42 | position='top' |
||
| 43 | size={0.1} |
||
| 44 | isVisible={this.state.isVisible} |
||
| 45 | dockStyle={this.style} |
||
| 46 | dim='transparent' |
||
| 47 | > |
||
| 48 | <div |
||
| 49 | id='menuContent' |
||
| 50 | onMouseLeave={() => { |
||
| 51 | if (!this.state.isLeavingPage) { |
||
| 52 | this.setState({ |
||
| 53 | isVisible: false |
||
| 54 | }) |
||
| 55 | } |
||
| 56 | }} |
||
| 57 | > |
||
| 58 | <ul> |
||
| 59 | <li> |
||
| 60 | <Link |
||
| 61 | onClick={() => { |
||
| 62 | this.setState({ |
||
| 63 | isLeavingPage: true |
||
| 64 | }) |
||
| 65 | }} |
||
| 66 | to='/insertion' |
||
| 67 | > |
||
| 68 | Insertion sort |
||
| 69 | </Link> |
||
| 70 | </li> |
||
| 71 | <li> |
||
| 72 | <Link |
||
| 73 | onClick={() => { |
||
| 74 | this.setState({ |
||
| 75 | isLeavingPage: true |
||
| 76 | }) |
||
| 77 | }} |
||
| 78 | to='/bubble' |
||
| 79 | > |
||
| 80 | Bubble Sort |
||
| 81 | </Link> |
||
| 82 | </li> |
||
| 83 | </ul> |
||
| 84 | </div> |
||
| 85 | </Dock> |
||
| 86 | </div> |
||
| 87 | ) |
||
| 90 |